import { http } from '../utils/request'
export const getArticlesList = () => {
  return http({
    url: '/channels',
    method: 'get',
  })
}

export const createArticle = (data) => {
  return http({
    url: '/mp/articles?draft=false',
    method: 'post',
    data,
  })
}

export const updateArticle = (data) => {
  return http({
    url: `/mp/articles/${data.id}?draft=false`,
    method: 'put',
    data,
  })
}

export const getArticleDetail = (params) => {
  return http({
    url: '/mp/articles',
    method: 'get',
    params,
  })
}

export const deleteArticle = (id) => {
  return http({
    url: `/mp/articles/${id}`,
    method: 'delete',
  })
}

export const getArticleId = (id) => {
  return http({
    url: `/mp/articles/${id}`,
    method: 'get',
  })
}
